package cn.al2.util.demo;

import cn.al2.util.GenerateUtil;

import java.io.FileOutputStream;
import java.io.IOException;

public class FileOutputStreamEveryDemo {

    public static void main(String[] args) throws IOException{
        // 文件路径
        String filePath = "FileOutputStreamDemoercer.txt";

        {


            long start = System.currentTimeMillis();


            for (String logStr : GenerateUtil.getInstance().staticProduct()) {

                FileOutputStream fos = new FileOutputStream(filePath,true);
                // 将字符串转换为字节数组
                byte[] bytes = logStr.getBytes();

                // 写入字节数组到文件
                fos.write(bytes);
            }

            long end = System.currentTimeMillis();

            System.out.println("fos 文件写入成功 耗时：" + (end - start));

        }}
}
